include('shared.lua')
ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Initialize()
	self.FrameA = 0
	self.lastthink = UnPredictedCurTime()
end

function ENT:OnRemove()
end

function ENT:Draw()
	self.Entity:DrawModel()
end

function ENT:Think()
	local delta = UnPredictedCurTime() - self.lastthink
	self.lastthink = UnPredictedCurTime()
	
	/*
	//Light
	local light = DynamicLight(self.Entity:EntIndex())
	if light then //and IsValid(light) then
		light.Pos = self.Entity:GetPos() + Vector(0,0,32)
		light.r,light.g,light.b = 255,140,0
		light.Brightness = 5
		light.Size = 256
		light.Decay = 512
		light.DieTime = CurTime()+1
	end
	*/
end

local Flame = Material("particles/fire1")

function ENT:DrawTranslucent() //message from Termy - Thank Chad "Jinto"
	local FlameStart = self:GetPos()
	local FlameEnd = FlameStart + Vector(0,0,120)
	
	//Animate
	self.FrameA = self.FrameA + FrameTime() * math.random(25, 35)
	if (self.FrameA > 53) then
		self.FrameA = self.FrameA - 53
	end
	
	//Draw
	Flame:SetMaterialFloat("$frame", self.FrameA)
	render.SetMaterial(Flame)
	render.DrawBeam(
		FlameStart,FlameEnd,
		48,
		0.99,0,
		Color(255,255,255,255)
	)
end
